#ifndef __HTTPREQUEST_H_
#define __HTTPREQUEST_H_
#include "KLib.h"

SK

typedef enum _HTTPMethod
{
	HTTP_GET,
	HTTP_POST,
	HTTP_UNKNOWN
}HTTPMethod;

typedef enum _HTTPFileType
{
	HTTP_FILE_TYPE_HTML,
	HTTP_FILE_TYPE_XML,
	HTTP_FILE_TYPE_BMP,
	HTTP_FILE_TYPE_PNG,
	HTTP_FILE_TYPE_JPG,
	HTTP_FILE_TYPE_CSS,
	HTTP_FILE_TYPE_JS,
	HTTP_FILE_TYPE_JARVCMD,
	HTTP_FILE_TYPE_UNKNOWN
}HTTPFileType;


typedef enum _HTTPFileMode
{
	HTTP_FILE_MODE_TEXT,
	HTTP_FILE_MODE_BINARY,
}HTTPFileMode;

class ISocket;

class HTTPRequest
{
protected:
	bool valid;
	bool extractFileInfo (const String& fle);

	static const int MAX_POST_DATA = 10000;
public:
	HTTPMethod method;
	String file;
	HTTPFileType fileType;
	HTTPFileMode fileMode;
	String fileMIME;
	String postData;
	
	//headers
	String host;
	String userAgent;
	bool conKeepAlive;
	StringArray acceptedEncodings;
	int contentLength;

	KeyValuePair otherHeaders;
	void parse (const String& requestStr);
	bool isValid (void);

	HTTPRequest ();
	HTTPRequest (const HTTPRequest& other);
	HTTPRequest (const String& requestStr);

	
};

EK

#endif